Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-String $LOAD_PATH values more carefully #400

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Sep 19, 2022

Fixes #394

In addition to String values, $LOAD_PATH can also take objects that respond_to the to_path method, like Pathname objects. So irb should be able to handle those objects too.

And if $LOAD_PATH contains objects that can't be converted into String, irb should simply ignore it.

@st0012
Copy link
Member Author

st0012 commented Sep 20, 2022

@peterzhu2118 can you give it a look when have time? thx

test/irb/test_completion.rb Outdated Show resolved Hide resolved
test/irb/test_completion.rb Outdated Show resolved Hide resolved
lib/irb/completion.rb Show resolved Hide resolved
@st0012 st0012 force-pushed the fix-#394 branch 2 times, most recently from 95b8fed to 67a8e79 Compare September 20, 2022 20:50
In addition to String values, $LOAD_PATH can also take objects that
respond_to the `to_path` method, like Pathname objects. So `irb` should
be able to handle those objects too.

And if $LOAD_PATH contains objects that can't be converted into String,
`irb` should simply ignore it.
Copy link
Member

@peterzhu2118 peterzhu2118 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@peterzhu2118 peterzhu2118 merged commit cd8f01e into ruby:master Sep 21, 2022
@st0012 st0012 mentioned this pull request Sep 21, 2022
@st0012 st0012 mentioned this pull request Oct 3, 2022
@st0012 st0012 deleted the fix-#394 branch October 3, 2022 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

IRB crashing on sorting completions if $LOAD_PATH contains Pathname
2 participants